import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_jd/pages/tabbar/cart/controller.dart';
import 'package:flutter_jd/ui/pages/cart/checkbox.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

// 店铺区域
class CartShopWrap extends GetWidget<CartController> {
  final int index;
  CartShopWrap(this.index);

  @override
  Widget build(BuildContext context) {
    bool isSelected = controller.productList[index]['isSelected'];

    return Container(
      width: double.infinity,
      color: Colors.white,
      padding: EdgeInsets.only(
        top: 15.h,
        left: 15.w,
        bottom: 12.h,
      ),
      child: Row(
        children: [
          // checkbox
          GestureDetector(
            onTap: () {
              controller.shopClick(index, isSelected);
            },
            child: CartCheckbox(isSelected),
          ),
          // shop title
          Container(
            margin: EdgeInsets.only(left: 12.w),
            child: Text(
              controller.productList[index]['title'],
              style: TextStyle(
                fontWeight: FontWeight.w500,
                fontSize: 15.sp,
              ),
            ),
          ),
        ],
      ),
    );
  }
}
